// ================================================
// SH INSTRUCTION TEST
//
// Expected result:
//   x3 = 0x00001234
//
// Memory:
//   0x1000 = 0x34
//   0x1001 = 0x12
// ================================================



start:
// Load memory address 0x1000 into x1
lui  x1, 0x1             // x1 = 0x00001000

// Create the value 0x1234 in x2
lui  x2, 0x1             // x2 = 0x00001000
addi x2, x2, 0x234       // x2 = 0x00001234

// Test SH
sh   x2, 0(x1)           // Store low 16 bits at 0x1000

// Read the halfword back
lh   x3, 0(x1)           // x3 should equal 0x00001234

cout << "SH test result = " << _to_hex x3 << endl;
